﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace HYWJ
{
    public partial class searchForm : Office2007Form
    {
        public searchForm()
        {
            InitializeComponent();
        }

        private void searchForm_Load(object sender, EventArgs e)
        {

        }

        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (treeView1.SelectedNode.Text.ToString()=="救援知识")
            {
                richTextBox1.Text = "灾害中，各种情况下与救援相关的知识。";
            }
            else if (treeView1.SelectedNode.Text.ToString() == "相关法律")
            {
                richTextBox1.Text = "国家出台的相关法律。";
            }
            else if (treeView1.SelectedNode.Text.ToString() == "组织结构与业务流程")
            {
                richTextBox1.Text = "与救灾有关的组织及其结构，还有相关救灾流程讲解。";
            }
            else if (treeView1.SelectedNode.Text.ToString() == "历史案例")
            {
                richTextBox1.Text = "历史案例查询。";
            }
            else if (treeView1.SelectedNode.Text.ToString() == "森林火灾救援")
            {
                open1(Application.StartupPath+@"\help\火灾.txt");
            }
            else if (treeView1.SelectedNode.Text.ToString() == "中华人民共和国森林法")
            {
                open1(Application.StartupPath + @"\help\中华人民共和国森林法.txt");
            }
            else
            {
                this.richTextBox1.Text = treeView1.SelectedNode.Text.ToString();
            }
        }

        private void open1(string file)
        {
            System.IO.StreamReader reader = new System.IO.StreamReader(file, System.Text.Encoding.Default);
            string content = reader.ReadToEnd();
            richTextBox1.Text = content;
            reader.Close();
        }
    }
}
